import 'package:flutter/material.dart';
import 'package:lib_uikit/lib_uikit.dart';
import 'package:lib_uikit/noticebar/gt_vertical_marquee.dart';

/// 公告通知栏
class GTNoticeBarV3 extends StatelessWidget {
  final List<String> list;
  final ValueChanged<int>? onPageSelected;
  final VoidCallback? rightIconClick;
  final double? paddingHorizontal;
  final double? paddingVertical;

  GTNoticeBarV3({
    super.key,
    required this.list,
    this.onPageSelected,
    this.rightIconClick,
    this.paddingHorizontal,
    this.paddingVertical,
  });

  Widget build(BuildContext context) {
    return Container(
      child: Row(
        children: [
          SizedBox(
            width: paddingHorizontal,
          ),
          Icon(
            GTIconFont.e988,
            size: 16,
            color: GTColorsV3.icon3.color,
          ),
          const SizedBox(
            width: 8,
          ),
          Expanded(
            child: GTVerticalMarquee(
              list: list,
              paddingVertical: paddingVertical,
              onPageSelected: (index) {
                onPageSelected?.call(index);
              },
            ),
          ),
          GestureDetector(
            onTap: () {
              rightIconClick?.call();
            },
            child: Padding(
              padding: GTEdgeInsetsOnly(left: 8, right: paddingHorizontal ?? 0,top: paddingVertical??0,bottom: paddingVertical??0),
              child: Icon(
                GTIconFont.e8b6,
                size: 12,
                color: GTColorsV3.icon3.color,
              ),
            ),
          ),
        ],
      ),
    );
  }
}
